<link rel="stylesheet" href="<?php echo URL::base() . 'media/js/jquery/css/ui-lightness/jquery-ui-1.8.16.custom.css' ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo URL::base() . 'media/js/jquery/css/ui-lightness/timepicker.css' ?>" type="text/css" />

<script type="text/javascript" src="<?php echo URL::base() . 'media/js/jquery/js/jquery-1.6.2.min.js' ?>"></script> 
<script type="text/javascript" src="<?php echo URL::base() . 'media/js/jquery/js/jquery.ui.datepicker-hu.js' ?>"></script> 
<script type="text/javascript" src="<?php echo URL::base() . 'media/js/jquery/js/jquery-ui-1.8.16.custom.min.js' ?>"></script>
<script type="text/javascript" src="<?php echo URL::base() . 'media/js/jquery/js/jquery-ui-timepicker-addon.js' ?>"></script>
<script type="text/javascript" src="<?php echo URL::base() . 'media/js/ckeditor/ckeditor.js' ?>"></script>

<script type="text/javascript">
    function addMoreUpload(){
        var i = document.createElement("input");
        i.type = "file";
        i.name = "files[]";
        i.id = "fileupload";
        obj = document.getElementById("files");
        obj.appendChild(i);
        i = document.createElement("br");
        obj.appendChild(i);
    }
</script>

<div>
    <?php echo form::open(NULL, array('enctype' => 'multipart/form-data')); ?>
        <ul>
            <li>
                <?php echo form::label('name', 'Tanfolyam neve'); ?>
                <?php if(isset($course)) echo form::input('name', $course->name); else echo form::input('name');?>
                <?php if(isset($errors['name']))echo ($errors['name']) ?>
            </li>
            <li>
                <?php echo form::label('description', 'Tanfolyam leírása'); ?>
                <?php echo $ckeditor->editor("description", @$course->description, $config) ?>
                <?php if(isset($errors['description']))echo ($errors['description']) ?>
            </li>
            <li>
                <?php echo form::label('date', 'Tanfolyam dátuma'); ?>
                <input id="date" name="date" type="textbox" value="<?php echo @$course->date ?>"/>
                <?php if(isset($errors['date']))echo ($errors['date']) ?>
            </li>
            <li>
                <?php echo form::label('from_time', 'Tanfolyam ideje'); ?>
                <input id="from_time" name="from_time" type="textbox" value="<?php echo @$course->from_time ?>"/>
                <?php if(isset($errors['from_time']))echo ($errors['from_time']) ?>
                -
                <input id="to_time" name="to_time" type="textbox" value="<?php echo @$course->to_time ?>"/>
                <?php if(isset($errors['to_time']))echo ($errors['to_time']) ?>
            </li>
            <li>
                <?php echo form::label('place', 'Tanfolyam helye'); ?>
                <?php if(isset($course)) echo form::input('place', $course->place); else echo form::input('place');?>
                <?php if(isset($errors['place']))echo ($errors['place']) ?>
            </li>
                <?php if(isset($files)){ ?>
                <li>
                <div id="files">
                    <label>Tanfolyam fájljai:</label><br/>
                    <ul>
                    <?php foreach($files as $file): ?>
                        <li><?php echo html::file_anchor('upload/coursefiles/'.$file->file, $file->file) ?>     <a href="<?php echo Url::site('course/deletefile/'.$file->id) ?>">Törlés</a></li>
                    <?php endforeach; ?>
                    </ul>
                    <label>Fájl(ok) feltöltése:</label><br />
                        <input type="file" name="files[]" id="fileupload"/><br />
                </div>
                <a href="#" onclick="addMoreUpload()">További fájl</a>
                </li>
                <?php } ?>
            <li>
                <?php echo form::submit('save', 'Mentés');?>
            </li>
            </ul>
    <?php echo form::close(); ?>
</div>
<script type="text/javascript">
        $.datepicker.setDefaults( $.datepicker.regional[ "hu" ] );
        $("#date").datepicker({
            showOn: 'button', 
            buttonImageOnly: true, 
            buttonImage: '<?php echo URL::base() . "media/js/jquery/images/icon_cal.png" ?>'
        });
        $('#from_time').timepicker({
            timeOnlyTitle: 'Válassz időpontot',
            timeText: 'Választott időpont:',
            hourText: 'Óra',
            minuteText: 'Perc',
            secondText: 'Másodperc',
            currentText: 'Most',
            closeText: 'Kész'
        });
        $('#to_time').timepicker({
            timeOnlyTitle: 'Válassz időpontot',
            timeText: 'Választott időpont:',
            hourText: 'Óra',
            minuteText: 'Perc',
            secondText: 'Másodperc',
            currentText: 'Most',
            closeText: 'Kész'
        });
</script>  